#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

struct student
{
    int num;
    char name[20];
    int score;
    char grade;
};

int set_grade(struct student* p, int n) 
{
    int i, g;
    g = 0;
    for (i = 0; i < n; i++, p++)
    {
        if (p->score > 84)
            p->grade = 'A';
        else if (p->score > 69)
            p->grade = 'B';
        else if (p->score > 59)
            p->grade = 'C';
        else
        {
            p->grade = 'D';
            g++;
        }
    }
    return g;
}

int main()
{
    struct student stu[10], * ptr;
    int n, i, count;

    ptr = stu;
    scanf("%d\n", &n);
    for (i = 0; i < n; i++) 
    {
        scanf("%d%s%d", &stu[i].num, stu[i].name, &stu[i].score);
    }
    count = set_grade(ptr, n);
    printf("The count for failed (<60): %d\n", count);
    printf("The grades:\n");
    for (i = 0; i < n; i++)
        printf("%d %s %c\n", stu[i].num, stu[i].name, stu[i].grade);
    return 0;
}